package com.mrx.mqtt.mqttintegration.mqtt.controller;

import com.mrx.mqtt.mqttintegration.mqtt.gateway.MqttGateway;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author XH.M
 * @create 2019-05-06 8:14
 */
@RestController
@RequestMapping("/api/mqtt")
public class TestController {
    @Autowired
    private MqttGateway mqttGateway;

    /** 测试信息推送 */
    @GetMapping("/send/{topic}")
    public void sendTest(@PathVariable("topic") String topic){
        mqttGateway.send("我们都是好孩子",topic);
    }
}
